package de.koller.transit.engine.brush;

import de.koller.oceanFramework.math.RVec2;
import de.koller.transit.TNode;

public class BrushContainer extends TNode {
	
	public final BrushPlayer playerA = new BrushPlayer();
	public final BrushPlayer playerB = new BrushPlayer();
	
	@Override
	protected void init() {
		super.init();
		
		playerA.brush.position.push( new RVec2( 100, troot.display.height / 2 ) );
		playerA.brush.color.color = 0xff_ff0000;
		playerA.brush.size.joinAdd( "default", 25 );
		playerA.brush.velocity.joinAdd( "default", 100 );
		playerA.brush.turnVelocity.joinAdd( "default", 1 );
		
		playerB.brush.position.push( new RVec2( troot.display.width - 100, troot.display.height / 2 ) );
		playerB.brush.color.color = 0xff_0000ff;
		playerB.brush.size.joinAdd( "default", 25 );
		playerB.brush.velocity.joinAdd( "default", 100 );
		playerB.brush.turnVelocity.joinAdd( "default", 1 );
		playerB.brush.direction.direction = -(float)Math.PI;
	}

	@Override
	protected void update( int elapsedTime ) {
		super.update( elapsedTime );
		
		if( elapsedTime == 0 )
			return;
		
		playerA.updateBrush( elapsedTime );
		troot.engine.paper.updatePaint( playerA.brush );
		
		playerB.updateBrush( elapsedTime );
		troot.engine.paper.updatePaint( playerB.brush );
	}
	
}
